package com.example.avmanagerweb.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.avmanagerweb.result.RLIST;
import com.example.avmanagerweb.service.FenceqryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xg
 * @since 2023-06-28
 */
@RestController
@RequestMapping("/fenceqry")
public class FenceqryController {

    @Autowired
    private FenceqryService fenceqryService;

    @GetMapping(value = "/queryFenceqry")
    public RLIST queryFenceqry(@RequestParam(value = "depid") Integer depid){
        QueryWrapper queryWrapper = new QueryWrapper();
        if(depid!=null ||depid != 0){
            queryWrapper.eq("DepId",depid);
        }
        queryWrapper.orderByAsc("FenceShapePosID");
        List list = fenceqryService.list(queryWrapper);
        return RLIST.ok().data("data",list);
    }

}

